<script setup>
import { useUserStore } from "@/stores";
import { storeToRefs } from "pinia";
const userStore = useUserStore();
const { userInfoForm, infoForm } = storeToRefs(userStore);
const { changeInfo, userInfoRules, copyInfo } = userStore;
copyInfo();
</script>

<template>
  <CardPage>
    <template #title> 基本资料 </template>
    <el-form
      size="large"
      :model="userInfoForm"
      :rules="userInfoRules"
      ref="infoForm"
    >
      <el-form-item label="登录名称">
        <el-input disabled v-model="userInfoForm.username"></el-input>
      </el-form-item>
      <el-form-item label="用户昵称" prop="nickname">
        <el-input v-model="userInfoForm.nickname"></el-input>
      </el-form-item>
      <el-form-item label="用户邮箱" prop="email">
        <el-input v-model="userInfoForm.email"></el-input>
      </el-form-item>
    </el-form>
    <el-button type="primary" @click="changeInfo">提交修改</el-button>
  </CardPage>
</template>
<style scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.el-form {
  width: 40%;
  height: 20vh;
  margin: 1vw;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.el-button {
  width: 5vw;
  height: 2vw;
  margin-left: 5vw;
}
</style>
